home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
tegl6b.zip
/
INTROPAK.EXE
/
lha
/
PCXDEMO.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-06-10
|
10KB
|
447 lines
{-----------------------------------------------------------------------------}
{ TEGL Windows ToolKit II }
{ Copyright (C) 1990, 1991 TEGL Systems Corporation }
{ All Rights Reserved. }
{-----------------------------------------------------------------------------}
{$M 20000,0,655360}
{-- Defaults }
{$A-} {-- A- byte alignment }
{$B-} {-- B- short circuit boolean evaluation }
{$D+} {-- D- No debug info }
{$E-} {-- E- No emulation }
{$F-} {-- F- Far calls only when necessary }
{$I-} {-- I- I/O error checking done internally }
{$L+} {-- L- No local symbols }
{$N-} {-- N- Software reals }
{$R-} {-- R- Range checking off }
{$S-} {-- S- Stack overflow off }
{$V-} {-- V- No strict type checking }
USES
crt,
errorlog,
ipstacks,
teglfont,
pcxgraph,
soundunt,
virtmem,
videochk,
teglmain,
tgi,
tgraph,
teglintr,
teglunit,
fastgrph;
const
{$I pcxdemo.inc}
var ix1,iy1,ix2,iy2,bt : integer;
{$F+}
Procedure lipspcxproc; External;
{$L lips2.obj}
{$F-}
function UserPressingButton(fs:ImageStkPtr; ms:MsClickPtr) : Boolean;
var mxpos,mypos : Word;
stat : Word;
ms1 : MsClickPtr;
begin
stat := MousePosition(mxpos,mypos);
IF FunctionKeyCode=0 THEN
ms1 := CheckMouseClickPos(fs,mxpos,mypos)
ELSE
BEGIN
stat := Ord(ScanCodeTable[lo(FunctionKeyCode)]);
ms1 := ms;
END;
UserPressingButton := (ms1=ms) and (stat<>0);
end;
{$F+}
Function ViewSecondScreen(ifs:ImageStkPtr; ms: MsClickPtr) : Word;
{$F-}
VAR
ax,ay,ax1,ay1 : Integer;
BEGIN
HideMouse;
ax := ms^.ms.x and $fff8;
ay := ms^.ms.y;
ax1 := ax + (ms^.ms.x1-ms^.ms.x);
ay1 := ms^.ms.y1;
MoveStackImage(ifs,ax,ay);
ShowMouse;
viewsecondscreen := 1;
END;
{$F+}
Function BounceDemo(ifs:ImageStkPtr; ms: MsClickPtr) : Word;
{$F-}
var i,j : integer;
d,e,r : boolean;
ch : char;
x,y,ct : integer;
begin
if visualsquarebuttonpress(ifs,ms) then
begin
hidemouse;
x := ifs^.x+16;
y := ifs^.y+16;
ix1 := ix1 and $fff8;
ix2 := ix1 + 368;
while keypressed do ch := readkey;
d := true;
e := true;
r := true;
ct := 1;
repeat
if d then
begin
while (iy2<338) and not keypressed and (mouse_buttons=0) do
begin
movevideopixels(ix1,iy1,ix2,iy2,x,y,0,0,ptr($a000,$9600),ptr($a000,$0000));
{ movevideopixels(ix1,iy1,ix2,iy2,x,y,0,0,$8000,0); }
inc(iy1,ct);
inc(iy2,ct);
end;
if iy2>338 then
begin
dec(iy1,ct);
dec(iy2,ct);
end;
end
else
begin
while (iy1>0) and not keypressed and (mouse_buttons=0) do
begin
movevideopixels(ix1,iy1,ix2,iy2,x,y,0,0,ptr($a000,$9600),ptr($a000,$0000));
{ movevideopixels(ix1,iy1,ix2,iy2,x,y,0,0,$8000,0); }
dec(iy1,ct);
dec(iy2,ct);
end;
if iy1<0 then
begin
inc(iy1,ct);
inc(iy2,ct);
end;
end;
d := not d;
if e then
begin
inc(ix1,8);
inc(ix2,8);
end
else
begin
dec(ix1,8);
dec(ix2,8);
end;
if ix2>639 then
begin
dec(ix1,8);
dec(ix2,8);
e := not e;
end
else
if ix1<0 then
begin
inc(ix1,8);
inc(ix2,8);
e := not e;
end;
if r then
begin
inc(ct);
if ct>10 then
r := not r;
end
else
begin
dec(ct);
if ct=1 then
r := not r;
end;
until keypressed or (mouse_buttons<>0);
showmouse;
while keypressed do ch := readkey;
while (mouse_buttons<>0) do;
ReleaseSquareButton(ifs,ms);
end;
BounceDemo := 1;
END;
{$F+}
Function ShiftVert(ifs:ImageStkPtr; ms: MsClickPtr) : Word;
{$F-}
var x,y,x1,y1 : integer;
begin
PressSquareButton(ifs,ms);
x := ifs^.x+16;
y := ifs^.y+16;
x1 := x+368+16;
y1 := y+168+16;
prepareforpartialupdate(ifs,x,y,x1,y1);
repeat
case ms^.clicknumber of
{/\} 7 : begin
{/\} dec(iy1,8);
dec(iy2,8);
end;
{/\} 8 : begin
dec(iy1);
dec(iy2);
end;
{\/} 9 : begin
inc(iy1);
inc(iy2);
end;
{\/} 10 : begin
{\/} inc(iy1,8);
inc(iy2,8);
end;
end;
if iy1<0 then
begin
iy1 := 0;
iy2 := 168;
end
else
if iy2>338 then
begin
iy1 := 338-(iy2-iy1);
iy2 := 338;
end;
movevideopixels(ix1,iy1,ix2,iy2,x,y,0,0,ptr($a000,$9600),ptr($a000,$0000))
until not userpressingbutton(ifs,ms);
commitupdate;
ReleaseSquareButton(ifs,ms);
shiftvert := 1;
end;
{$F+}
Function ScrollHorz(ifs:ImageStkPtr; ms: MsClickPtr) : Word;
{$F-}
var x,y,x1,y1 : integer;
begin
PressSquareButton(ifs,ms);
x := ifs^.x+16;
y := ifs^.y+16;
x1 := x+368;
y1 := y+168;
prepareforpartialupdate(ifs,x,y,x1,y1);
repeat
case ms^.clicknumber of
{.<} 11 : movevideopixels(x,y,x1,y1,x,y,0,8,ptr($a000,$0000),ptr($a000,$0000));
{.>} 13 : movevideopixels(x,y,x1,y1,x,y,0,-8,ptr($a000,$0000),ptr($a000,$0000));
end;
until not userpressingbutton(ifs,ms);
commitupdate;
ReleaseSquareButton(ifs,ms);
scrollhorz := 1;
end;
{$F+}
Function ScrollVert(ifs:ImageStkPtr; ms: MsClickPtr) : Word;
{$F-}
var x,y,x1,y1 : integer;
begin
PressSquareButton(ifs,ms);
x := ifs^.x+16;
y := ifs^.y+16;
x1 := x+368;
y1 := y+168;
prepareforpartialupdate(ifs,x,y,x1,y1);
repeat
case ms^.clicknumber of
{.^} 12 : movevideopixels(x,y,x1,y1,x,y,-8,0,ptr($a000,$0000),ptr($a000,$0000));
{.v} 14 : movevideopixels(x,y,x1,y1,x,y,8,0,ptr($a000,$0000),ptr($a000,$0000));
end;
until not userpressingbutton(ifs,ms);
commitupdate;
ReleaseSquareButton(ifs,ms);
scrollvert := 1;
end;
{$F+}
Function ShiftHorz(ifs:ImageStkPtr; ms: MsClickPtr) : Word;
{$F-}
var x,y,x1,y1 : integer;
begin
PressSquareButton(ifs,ms);
x := ifs^.x+16;
y := ifs^.y+16;
x1 := x+368;
y1 := y+168;
prepareforpartialupdate(ifs,x,y,x1,y1);
repeat
case ms^.clicknumber of
{<<} 3 : begin
dec(ix1,8);
dec(ix2,8);
ix2 := ix2 - (ix1 and 7);
ix1 := ix1 and $fff8;
end;
{<} 4 : begin
dec(ix1);
dec(ix2);
end;
{>} 5 : begin
inc(ix1);
inc(ix2);
end;
{>>} 6 : begin
inc(ix1,8);
inc(ix2,8);
ix2 := ix2 - (ix1 and 7);
ix1 := ix1 and $fff8;
end;
end;
if ix1<0 then
begin
ix1 := 0;
ix2 := 368;
end
else
if ix2>639 then
begin
ix1 := 639-(ix2-ix1);
ix2 := 639;
end;
movevideopixels(ix1,iy1,ix2,iy2,x,y,0,0,ptr($a000,$9600),ptr($a000,$0000));
until not userpressingbutton(ifs,ms);
commitupdate;
ReleaseSquareButton(ifs,ms);
shifthorz := 1;
end;
{$F+}
Function SquareButtonTest(ifs:ImageStkPtr; ms: MsClickPtr) : Word;
{$F-}
begin
if visualsquarebuttonpress(ifs,ms) then
begin
ReleaseSquareButton(ifs,ms);
end;
squarebuttonTest := 0;
end;
{$F+}
Function ExitOption(ifs:ImageStkPtr; ms: MsClickPtr) : Word;
{$F-}
BEGIN
if visualsquarebuttonpress(ifs,ms) then
Abortexit('TEGL PCX Graphics DEMO');
exitoption := 1;
END;
BEGIN
maxwindowsize := 128000;
IF RegisterTGIDriver(@_grevga16_driver)=0 THEN;
SetStandardHeapSize(64000); {Reserve about 32k for Video Drivers}
setvideochoices(TG_CGA,FALSE);
setvideochoices(TG_HGC,FALSE);
TEGLInit(videoautodetect,20480);
SetPCXBWMap($ff,$ff,$00,$ff);